-
Notifications
You must be signed in to change notification settings - Fork 95
Add 'stream' and 'future' types #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
An earlier version of the design had separate For symmetry with the rest of the built-ins, could we split |
@dicej Great point, and agreed. Split back up in this commit. |
For visibility: this commit adds |
Thanks for all the excellent feedback everyone! I think the comments are dying down and it sounds like this is on a convergence path with @dicej's impl, so if nothing new pops up, I think I'll merge mid next week (and then we can continue to iterate on async in new issues and PRs). FWIW, I think the next change I'd like to make is a PR that removes the |
One other update: for both the pragmatic short-term benefit of avoiding parsing conflicts with the |
This adds support for encoding and parsing components which use the [Async ABI](https://github.com/WebAssembly/component-model/blob/main/design/mvp/Async.md) and associated canonical options and functions, along with the [`stream`, `future`, and `error`](WebAssembly/component-model#405) types. Note that the `error` type was recently (about 30 minutes ago) renamed to `error-context` in Luke's spec PR. I haven't updated this implementation to reflect that yet, but will do so in a follow-up commit. That should allow us to avoid conflicts with existing WIT files that use `error` as a type and/or interface name. This does not include any new tests; I'll also add those in a follow-up commit. See bytecodealliance/rfcs#38 for more context. Signed-off-by: Joel Dice <[email protected]>
Co-authored-by: Joel Dice <[email protected]>
Co-authored-by: Joel Dice <[email protected]>
This PR builds on #363 to add
future
andstream
type constructors along with the associated canon built-ins ({stream,future}.new
,{stream,future}.{read,write}
,{stream,future}.cancel-{read,write}
). It also generalizes the "async_subtasks
" table to also hold futures and streams, renaming it to be the "waitables
" table and renamingsubtask.drop
towaitable.drop
. Lastly, a newcanonopt
calledalways-task-return
is added so that sync-lifted exports can usetask.return
to return their value, which you need if you want to return a stream or future from a synchronous function.I'd suggest reading the new text in Explainer.md/Binary to get a short overview of the concrete syntactic/binary additions, then Async.md to get the high-level summary, then CanonicalABI.md to get the full details.